#ifndef ANDRES_BASE_DEFINES_H
#define ANDRES_BASE_DEFINES_H

#include <eigen3/Eigen/Core>
#include <eigen3/Eigen/Dense>
#include <string>
#include "common.h"

struct GeoPoint
{
    double longitude;
    double latitude;
    double altitude;
    double x;
    double y;
    double z;
    double speed;
	double yawrate;
    unsigned long timestamp;
    std::string imagename;
    double bearing;
};

struct hdmap_lane
{
    std::vector<Eigen::Vector3d> geometry;
    int mark_type; //0-Unknwon, 1-solid, 2-dash, 4-specfic
    int id;

    double getDir();
};

struct hdmap_sign
{
    std::vector<Eigen::Vector3d> geometry;
    int id;
    double heading;
};

struct hdmap_frame
{
	std::vector<hdmap_lane> hdmap_lanes;
	std::vector<hdmap_sign> hdmap_signs;
};

struct ARSLane
{
	Eigen::Vector3d line_arg2D; // a * x + b * y + c = 0
	std::vector<Eigen::Vector2d> geometry2D;
	std::vector<Eigen::Vector3d> geometry3D;
	int mark_type; 				//0-Unknwon, 1-solid, 2-dash, 4-specfic
};

struct DlLane
{
	unsigned int id;		// id, increment from left to right
	int mark_type;			//0-Unknwon, 1-solid, 2-dash, 4-specfic
    int mark_color;
	std::vector<Eigen::Vector2d> polygon;
	std::vector<Eigen::Vector2d> calibrated_polygon;
	envelope2D bBox;

    void SetColor(const std::string& category)
	{
		if (category == "")
			return;

		if (category == "8010" ||
			category == "8011" ||
			category == "8012" ||
			category == "8013" ||
			category == "8014")
			mark_color = 2;
		else
			mark_color = 1;
	}

	void SetType(const std::string& category)
	{
		if (category == "")
			return;

		if (category == "8010" ||
			category == "8011" ||
			category == "8000" ||
			category == "8007")
			mark_type = 1;
		else if (category == "8004" ||
			category == "8005" ||
			category == "8002" ||
			category == "8014")
			mark_type = 4;
		else
			mark_type = 2;
	}
};

enum SIGN_STATUS {
    NORMAL,
    NOISE,
    OVER_LAYPPED
};

struct DlSign
{
    unsigned int id;
	std::string category;
	envelope2D  bBox;
	envelope2D  calibrated_bbox;
	SIGN_STATUS status;

	bool is_overlaypped()  { return status == OVER_LAYPPED; }
    void set_overlaypped() { status = OVER_LAYPPED; } 
};

struct DlFrame
{
	std::vector<DlLane> lanes;
	std::vector<DlSign> signs;
};

class Pose
{
public:
	Eigen::Vector3d position;  // NED position
	Eigen::Quaternion<double> orientation;
	EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};


#endif